package com.nbgroup.pojo.dto;

import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@NoArgsConstructor
@AllArgsConstructor
@ApiOperation("分页查询参数模型")
public class PageQueryDTO {

    @ApiModelProperty("查询的页码")
    private Integer pageNum;    //查询的页码

    @ApiModelProperty("查询的最大记录数")
    private Integer pageSize;   //单页最大记录数

    /**
     * 对入参做健壮性判断
     */

    public void check(){
        if (pageNum <= 0){
            pageNum = 1;
        }
        if (pageSize <= 0 || pageSize > 100){
            pageSize = 10;
        }
    }
}
